package com.eve.springcloud.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.eve.springcloud.common.Jsons;

@RestController
public class NacosOrderController {
	
	@Value("${server.port}")
	private String serverPort;
	
	public static HashMap<Long, String> hashMap = new HashMap<>();
	static {
		hashMap.put(1l, "asdoiadsiuasdkaswd1");
		hashMap.put(2l, "wejhrfqlewjr;qwerk;2");
		hashMap.put(3l, "qwjl;fvg;asj;sldfnlk3");
	}
	
	@RequestMapping("/fallback/{id}")
	public Jsons fallback(@PathVariable("id") Long id) {
		String string = hashMap.get(id);
		Jsons result = Jsons.ok("from mysql, Server port:" + serverPort).put("data", string);
		return result;
	}
	
}
